#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
    int missingNumber(vector<int>& nums) {
        int num = 0;
        for (int i = 0; i <= nums.size(); i++) num ^= i;
        for (const auto& e : nums) num ^= e;
        return num;
    }
};